//************************************************************************
/// <copyrigth>2024-2025 Corporation.All Rights Reserved</copyrigth>
/// <author>tangyingzhong</author>
/// <contact>tangyz114987@outlook.com</contact>
/// <version>v1.0.0</version>
/// <describe>
/// Cross-platform dynamic library loader
///</describe>
/// <date>2024/1/8</date>
///***********************************************************************
#ifndef DLLLOADER_H
#define DLLLOADER_H

#include <string>
#include "ModuleLoader/ModuleConfig.h"

namespace SystemTool
{
    class CLASS_ITEM DllLoader
    {
    public:
        // Construct the loader
        DllLoader();

        // Construct the loader
        DllLoader(std::string strDllFileName);

        // Destruct the loader
        ~DllLoader();

    private:
        // Forbidden the copy construct
        DllLoader(const DllLoader& other) = delete;

        // Forbidden the assignment
        DllLoader& operator=(const DllLoader& other) = delete;

    public:
        // Load the library
        bool Load(std::string strDllFileName);

        // Unload the library
        void UnLoad();

        // Is library loaded
        bool IsLoaded();

        // Get export function
        void* GetExportFunc(std::string strFuncName);

    private:
        // Loader
        void* m_pLoader;
    };
}

#endif // DLLLOADER_H
